Repository navigation
Config paths Phase 3: extension project fragments as virtual files; site-rooted spelling for rebased website assets (bd-0x1znhgb) - #959
Merged
Conversation
…-rooted spelling for rebased website assets (bd-0x1znhgb) Two things `resolve_metadata_path` got wrong by re-deriving the base directory from the source span: a value rebased by `rebase_fragment_paths` kept its `_extension.yml` span while its string was already project-root-relative, and an `href: index.qmd` in an extension's `contributes.project` fragment names a project page but was authored under `_extensions/<ext>/`. bd-74ktvzv7 patched both with a file-name check on `_extension.yml`, which no other consumer shared and which was wrong for the manifest's `contributes.metadata` / `contributes.formats` values (those do name bundled files). - Rebased `FRAGMENT_SITE_PATH_PATTERNS` strings (`website.favicon`, `navbar.logo`, `navbar.logo-href`, `sidebar.logo`) now carry the site-rooted spelling `/_extensions/<ext>/…` (plan §4.4 option a): self-describing in URL space, and every consumer already strips the `/`. A file outside the project keeps its OS-absolute form. - The project fragment is a virtual file of its own: at config time its spans are re-keyed to `config_paths::project_fragment_file_id` (`rekey_project_fragment`), and the merge stage plus every config-source binder (`config_sources::config_file_ids`, `register_config_source`, `bind_config_source`, project_resources, compile_theme_css) register that id with the manifest's path and bytes. `config_paths::file_base_dir(id, path, project_dir)` is the one rule — project root for a fragment id, the file's directory otherwise — and `declaring_dir`, `resolve_metadata_path` and `glob::provenance::BaseDirContext::base_dir_for` all use it. Snippets still render into `_extension.yml`; the file-name check is gone. A provenance wrapper on each value (`Generated` + invocation anchor) was tried first and rejected: the published error-reporting crate renders a location from `start_offset()`, which is 0 for `Generated`, so every fragment-anchored diagnostic lost its snippet. The plan records the trade-off. Tests: config_paths (fragment id resolves against the root, the manifest's own id against the extension dir; re-keying reaches every span), navigation_href, glob provenance, custom_project_type (new spelling), a new integration test for a fragment `resources:` glob. Docs: extensions guide notes the merged spelling. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Base automatically changed from
feature/bd-7328beha-url-space-config-paths
to
main
October 28, 2026 22:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #958 (base branch
feature/bd-7328beha-url-space-config-paths); retarget tomainafter #958 merges.What was wrong
resolve_metadata_pathre-derived a value's base directory from its source span. Two cases broke that: a value rebased byrebase_fragment_pathskept its_extension.ymlspan while its string was already project-root-relative, and anhref: index.qmdin an extension'scontributes.projectfragment names a project page but was authored under_extensions/<ext>/. bd-74ktvzv7 patched both with a file-name check on_extension.yml— not shared byconfig_paths::declaring_diror the glob provenance, and wrong for the manifest'scontributes.metadata/contributes.formatsvalues, which do name bundled files.What this does
FRAGMENT_SITE_PATH_PATTERNSstrings (website.favicon,navbar.logo,navbar.logo-href,sidebar.logo) are now/_extensions/<ext>/…: self-describing in URL space; every consumer already strips the/. Visible inget-config(documented in the extensions guide). A file outside the project keeps its OS-absolute form.config_paths::project_fragment_file_id(rekey_project_fragment), and the merge stage plus every config-source binder (config_sources::config_file_ids,register_config_source,bind_config_source,project_resources,compile_theme_css) register that id with the manifest's path and bytes. One rule,config_paths::file_base_dir(id, path, project_dir), gives the project root for a fragment id and the file's directory otherwise;declaring_dir,resolve_metadata_pathandglob::provenance::BaseDirContext::base_dir_forall call it. Diagnostics still render into_extension.yml; the file-name check is gone; a fragmentlisting.contents/resources:glob now anchors at the project root too.Design note
A per-value provenance wrapper (
Generated { by: config-base, from: [invocation anchor] }) was the first cut and is what the strand asked for. It was rejected: the publishedquarto-error-reportingrenders a location fromstart_offset()/length(), which are0forGenerated, so three CLI tests lost their_extension.ymlsnippet.ConfigValuehas ~216 struct-literal sites, so a new field was out. The virtual-file id keeps every spanOriginaland needs no plumbing. The plan's Phase 3 handoff records this;file_base_diris the one place to switch if the source-map crate gains a first-class base.Tests
config_paths: fragment id resolves against the root, the manifest's own id against the extension dir; re-keying reaches every span and leaves other files alone.navigation_href: fragment id → project-root-relative; a plain_extension.ymlspan → its own dir (the file-name rule is gone).glob::provenance,custom_project_type(new spelling),metadata_path_resolution(existing fragment logo/favicon/href tests unchanged; new fragmentresources:glob test).cargo xtask verify --skip-hub-buildgreen locally (WASM rebuilt first).🤖 Generated with Claude Code